package com.dao.impl;

import com.dao.UserDao;
import com.domain.Account;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;

import javax.annotation.Resource;
import java.util.List;

//<bean id="userDao" class="UserDaoImpl"></bean>
@Repository("userDao")
public class UserDaoImpl implements UserDao {
    @Resource
    private JdbcTemplate jdbcTemplate;

    public void save() {
        System.out.println("save running....");
    }
    public List queryAll() {
        String sql = "select * from account where name='Tom'";
        List<Account> us  = jdbcTemplate.query(sql, new BeanPropertyRowMapper<Account>(Account.class));
        return us;
    }
}
